package com.yiduo.outpost.ucenter.service;

import com.yiduo.outpost.core.model.entity.User;
import com.yiduo.outpost.core.model.enums.UserRole;
import com.yiduo.outpost.core.model.enums.UserStatus;
import com.yiduo.outpost.ucenter.model.dto.SignUpRequestBody;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import java.time.Duration;

/**
 * @Author yanwen
 * @create 2023/12/28 17:50
 */
public interface SessionService {
    /**
     * 登录验证
     *
     * @param loginKey
     * @param password
     * @return
     */
    Authentication authenticate(String loginKey, String password);

    /**
     * 注册
     *
     * @param signUpRequestBody
     * @return
     */
    User signUp(SignUpRequestBody signUpRequestBody);

    /**
     * 创建token
     *
     * @param authentication
     * @param ttl
     * @return
     */
    String createToken(Authentication authentication, Duration ttl);

    /**
     * 刷新token
     *
     * @param token
     */
    void refreshToken(Long userId, String token,Duration ttl);

    void logout(Long userId);
}
